home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / open.man < prev    next >
Encoding:
Text File  |  1990-08-05  |  6.8 KB  |  199 lines

  1.  
  2.  
  3.  
  4. OPEN                  C Library Procedures                   OPEN
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      open - open a file for reading or writing, or create a new
  10.      file
  11.  
  12. SSYYNNOOPPSSIISS
  13.      ##iinncclluuddee <<ssyyss//ffiillee..hh>>
  14.  
  15.      ooppeenn((ppaatthh,, ffllaaggss,, mmooddee))
  16.      cchhaarr **ppaatthh;;
  17.      iinntt ffllaaggss,, mmooddee;;
  18.  
  19. DDEESSCCRRIIPPTTIIOONN
  20.      _O_p_e_n opens the file _p_a_t_h for reading and/or writing, as
  21.      specified by the _f_l_a_g_s argument and returns a descriptor for
  22.      that file.  The _f_l_a_g_s argument may indicate the file is to
  23.      be created if it does not already exist (by specifying the
  24.      O_CREAT flag), in which case the file is created with mode
  25.      _m_o_d_e as described in _c_h_m_o_d(2) and modified by the process'
  26.      umask value (see _u_m_a_s_k(2)).
  27.  
  28.      _P_a_t_h is the address of a string of ASCII characters
  29.      representing a path name, terminated by a null character.
  30.      The flags specified are formed by _o_r'ing the following
  31.      values
  32.  
  33.            O_RDONLY      open for reading only
  34.            O_WRONLY      open for writing only
  35.            O_RDWR        open for reading and writing
  36.            O_APPEND      append on each write
  37.            O_CREAT       create file if it does not exist
  38.            O_TRUNC       truncate size to 0
  39.            O_EXCL        error if create and file exists
  40.            O_MASTER      open pseudo-device as master
  41.            O_PFS_MASTER  open pseudo-file-system as master
  42.  
  43.      Opening a file with O_APPEND set causes each write on the
  44.      file to be appended to the end.  If O_TRUNC is specified and
  45.      the file exists, the file is truncated to zero length.  If
  46.      O_EXCL is set with O_CREAT, then if the file already exists,
  47.      the open returns an error.  This can be used to implement a
  48.      simple exclusive access locking mechanism.  If O_EXCL is set
  49.      and the last component of the pathname is a symbolic link,
  50.      the open will fail even if the symbolic link points to a
  51.      non-existent name.
  52.  
  53.      The O_MASTER and O_PFS_MASTER flags are used by server
  54.      processes implementing pseudo-devices and pseudo-file-
  55.      systems (respectively).  See the man pages _P_d_e_v and _P_f_s for
  56.      details on how these flags are used.
  57.  
  58.      Upon successful completion a non-negative integer termed a
  59.      file descriptor is returned.  The file pointer used to mark
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 14, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. OPEN                  C Library Procedures                   OPEN
  71.  
  72.  
  73.  
  74.      the current position within the file is set to the beginning
  75.      of the file.
  76.  
  77.      The new descriptor is set to remain open across _e_x_e_c_v_e sys-
  78.      tem calls; see _c_l_o_s_e(2).
  79.  
  80.      The system imposes a limit on the number of file descriptors
  81.      open simultaneously by one process.  _G_e_t_d_t_a_b_l_e_s_i_z_e(2)
  82.      returns the current system limit.
  83.  
  84. EERRRROORRSS
  85.      The named file is opened unless one or more of the following
  86.      are true:
  87.  
  88.      [ENOTDIR]      A component of the path prefix is not a
  89.                     directory.
  90.  
  91.      [EINVAL]       The pathname contains a character with the
  92.                     high-order bit set.
  93.  
  94.      [ENAMETOOLONG] A component of a pathname exceeded 255 char-
  95.                     acters, or an entire path name exceeded 1023
  96.                     characters.
  97.  
  98.      [ENOENT]       O_CREAT is not set and the named file does
  99.                     not exist.
  100.  
  101.      [ENOENT]       A component of the path name that must exist
  102.                     does not exist.
  103.  
  104.      [EACCES]       Search permission is denied for a component
  105.                     of the path prefix.
  106.  
  107.      [EACCES]       The required permissions (for reading and/or
  108.                     writing) are denied for the named flag.
  109.  
  110.      [EACCES]       O_CREAT is specified, the file does not
  111.                     exist, and the directory in which it is to be
  112.                     created does not permit writing.
  113.  
  114.      [ELOOP]        Too many symbolic links were encountered in
  115.                     translating the pathname.
  116.  
  117.      [EISDIR]       The named file is a directory, and the argu-
  118.                     ments specify it is to be opened for writ-
  119.                     ting.
  120.  
  121.      [EROFS]        The named file resides on a read-only file
  122.                     system, and the file is to be modified.
  123.  
  124.      [EMFILE]       The system limit for open file descriptors
  125.                     per process has already been reached.
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 14, 1986                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. OPEN                  C Library Procedures                   OPEN
  137.  
  138.  
  139.  
  140.      [ENFILE]       The system file table is full.
  141.  
  142.      [ENXIO]        The named file is a character special or
  143.                     block special file, and the device associated
  144.                     with this special file does not exist.
  145.  
  146.      [ENOSPC]       O_CREAT is specified, the file does not
  147.                     exist, and the directory in which the entry
  148.                     for the new file is being placed cannot be
  149.                     extended because there is no space left on
  150.                     the file system containing the directory.
  151.  
  152.      [ENOSPC]       O_CREAT is specified, the file does not
  153.                     exist, and there are no free inodes on the
  154.                     file system on which the file is being
  155.                     created.
  156.  
  157.      [EDQUOT]       O_CREAT is specified, the file does not
  158.                     exist, and the directory in which the entry
  159.                     for the new fie is being placed cannot be
  160.                     extended because the user's quota of disk
  161.                     blocks on the file system containing the
  162.                     directory has been exhausted.
  163.  
  164.      [EDQUOT]       O_CREAT is specified, the file does not
  165.                     exist, and the user's quota of inodes on the
  166.                     file system on which the file is being
  167.                     created has been exhausted.
  168.  
  169.      [EIO]          An I/O error occurred while making the direc-
  170.                     tory entry or allocating the inode for
  171.                     O_CREAT.
  172.  
  173.      [ETXTBSY]      The file is a pure procedure (shared text)
  174.                     file that is being executed and the _o_p_e_n call
  175.                     requests write access.
  176.  
  177.      [EFAULT]       _P_a_t_h points outside the process's allocated
  178.                     address space.
  179.  
  180.      [EEXIST]       O_CREAT and O_EXCL were specified and the
  181.                     file exists.
  182.  
  183.      [EOPNOTSUPP]   An attempt was made to open a socket (not
  184.                     currently implemented).
  185.  
  186. SSEEEE AALLSSOO
  187.      chmod(2), close(2), dup(2), getdtablesize(2), lseek(2),
  188.      read(2), write(2), umask(2), fileno(3)
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0               May 14, 1986                          3
  196.  
  197.  
  198.  
  199.